package list_.set_;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * @description:
 * @Author yyp
 * @time
 */
public class SetMethod {
    public static void main(String[] args) {
        Set set = new HashSet();
        set.add("a");
        System.out.println(set);
        set.add("a");
        System.out.println(set);
        set.add("b");
        System.out.println(set);
        set.add("c");
        System.out.println(set);

        Iterator iterator = set.iterator();
        while (iterator.hasNext()){
            Object obj = iterator.next();
            System.out.println(obj);
        }

        for (Object o : set) {
            System.out.println(o);
        }

    }
}
